<HTML><HEAD><TITLE>cputime(-Time)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Operating System</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>cputime(-Time)</H1>
Succeeds if Time is the elapsed user cpu time in seconds.


<DL>
<DT><EM>Time</EM></DT>
<DD>Float number or variable.
</DD>
</DL>
<H2>Description</H2>
   Used to find the elapsed user cpu time in seconds, it is equivalent to
   statistics(times, [Time|_]).

<P>
   The cpu time is the `user' time i.e.  the CPU time used while executing
   instructions in the user space of the calling process.

<P>
   Note that the granularity of the system clock is usually 1/60 or 1/50 of
   a second.  Hence if you use cputime/1 to measure runtimes make sure that
   the measured intervals are long enough.

<P>
   The time given by the ps command gives the sum of `user' time and
   `system' time, which is the CPU time used by the system on behalf of the
   calling process.

<P>
    Note that (like all predicates that return a number as their last
    argument), this predicate can be used as a function inside arithmetic
    expressions.

<H3>Modes and Determinism</H3><UL>
<LI>cputime(-) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(5) type error </EM>
<DD>Time is instantiated, but not to a float.
</DL>
<H2>Examples</H2>
<PRE>
Success:
   [eclipse]: cputime(T).
   T = 0.0333333
   yes.

Fail:
      cputime(0.000001).
Error:
      cputime(2).                    (Error 5).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/env/statistics-0.html">statistics / 0</A>, <A HREF="../../kernel/env/statistics-2.html">statistics / 2</A>, <A HREF="../../kernel/opsys/date-1.html">date / 1</A>, <A HREF="../../kernel/env/get_flag-2.html">get_flag / 2</A>
</BODY></HTML>
